import  Explorer.SERVER as SRV
# / ** @ link http: # kodcloud.com /
# * @ author warlee | e - mail: kodcloud @ qq.com
# * @ copyright warlee 2014.(Shanghai) Co., Ltd
# * @ license http: # kodcloud.com / tools / license / license.txt
# * /

# 配置数据, 可在setting_user.php中添加变量覆盖, 升级后不会被替换
PLUGIN_HOST = '' # 静态文件目录
APP_HOST = "http://kode.localhsot"
KOD_VERSION = 1.1
SYSTEMPASSWORD = "admin"
LANGUAGE = "zh"
config = {
    "settings":{
    'downloadUrlTime' : 0, # 下载地址生效时间，按秒计算，0代表不限制
    'apiLoginTonken' : '', # 设定则认为开启服务端api通信登陆，同时作为加密密匙
    'updloadChunkSize' : 1024 * 1024 * 0.4, # 0.4M;分片上传大小设定;需要小于php.ini上传限制的大小
    'updloadThreads' : 10, # 上传并发数;部分低配服务器上传失败则将此设置为1
    'updloadBindary' : 0, # 1: 以二进制方式上传;后端服务器以php: # input接收;0则为传统方式上传
    'uploadCheckChunk' : True, # 开关断点续传，一个文件上传一半时中断，同一个文件再次上传到同一个位置时会接着之前的进度上传。
    'paramRewrite' : False, # 开启url去除? 直接跟参数
    'httpSendFile' : False, # 调用webserver下载http: # www.laruence.com / 2012 / 05 / 02 / 2613.html;
    # https: # www.lovelucy.info / x - sendfile - in -nginx.html
    
    'pluginServer' : "http:#api.kodcloud.com/?",
                       'staticPath' : "./static/", # 静态文件目录, 可以配置到cdn;
    'pluginHost' : PLUGIN_HOST # 静态文件目录
    }
}

# windows upload threads; 兼容不支持并发的服务器
# if config['systemOS'] == 'windows':
#     config['settings']['updloadThreads'] = 1

# windows iis bin上传有限制
if SRV.SERVER['SERVER_SOFTWARE'].find('-IIS')==-1:
    config['settings']['updloadBindary'] = 0

# 自适应https
# if (substr(APP_HOST, 0, 8) == 'https:#'){
# $config['settings']['pluginServer'] = str_replace("http:#", 'https:#', $config['settings']['pluginServer']);
# }

config['settings']['appType'] = [
    {'type' : 'tools', 'name' : 'app_group_tools', 'class' : 'icon-suitcase'}
    ,{'type' : 'movie', 'name' : 'app_group_movie', 'class' : 'icon-film'}
    ,{'type' : 'music', 'name' : 'app_group_music', 'class' : 'icon-music'}
    ,{'type' : 'life', 'name' : 'app_group_life', 'class' : 'icon-map-marker'}
    ,{'type' : 'others', 'name' : 'app_group_others', 'class' : 'icon-ellipsis-horizontal'}
]

config['defaultPlugins'] = [
'adminer', 'DPlayer', 'imageExif', 'jPlayer', 'officeLive', 'photoSwipe', 'picasa' # ,'pdfjs'
,'simpleClock', 'toolsCommon', 'VLCPlayer', 'webodf', 'yzOffice', 'zipView'
]



# 初始化系统配置
config['settingSystemDefault'] = {
     'systemPassword' : SYSTEMPASSWORD,
     'systemName' : "KodExplorer",
    'systemDesc' : "——可道云.资源管理器",
     'pathHidden' : "Thumb.db,.DS_Store,.gitignore,.git", # 目录列表隐藏的项
    'autoLogin' : "0", # 是否自动登录；登录用户为guest
    'needCheckCode' : "0", # 登陆是否开启验证码；默认关闭
    'firstIn' : "explorer", # 登录后默认进入[explorer desktop, editor]
    'newUserApp' : "trello,一起写office,微信,365日历,石墨文档,ProcessOn,计算器,icloud,OfficeConverter",
    'newUserFolder' : "document,desktop,pictures,music",
    'newGroupFolder' : "share,doc,pictures", # 新建分组默认建立文件夹
    'groupShareFolder' : "share",
    'desktopFolder' : 'desktop', # 桌面文件夹别名
    'versionType' : "A", # 版本
    'rootListUser' : 0, # 组织架构根节点展示群组内用户
    'rootListGroup' : 0, # 组织架构根节点展示子群组
    'csrfProtect' : 0, # 开启csrf保护
    'currentVersion' : KOD_VERSION,
    'wallpageDesktop' : "1,2,3,4,5,6,7,8,9,10,11,12,13",
    'wallpageLogin' : "2,3,6,8,9,11,12"
}
# 初始化默认菜单配置
config['settingSystemDefault']['menu'] = [
    {'name' : 'desktop', 'type' : 'system', 'url' : 'index.php?desktop', 'target' : '_self', 'use' : '1'},
    {'name' : 'explorer', 'type' : 'system', 'url' : 'index.php?explorer', 'target' : '_self', 'use' : '1'},
    {'name' : 'editor', 'type' : 'system', 'url' : 'index.php?editor', 'target' : '_self', 'use' : '1'}
]



# if (strstr(I18n::defaultLang(), 'zh') | | strstr(I18n::
#     getType(), 'zh') ):
if LANGUAGE.find('zh')!=-1:
    config['settingSystemDefault']['newGroupFolder'] = "share,文档,图片资料,视频资料";
    config['settingSystemDefault']['newUserFolder'] = "我的文档,图片,视频,音乐";


# 新用户初始化默认配置
config['settingDefault'] = {
    'listType': "icon", # list | | icon | | split
    'listSortField' : "name", # name | | size | | ext | | mtime
    'listSortOrder' : "up", # asc | | desc
    'fileIconSize' : "80", # 图标大小
    'animateOpen' : "1", # dialog动画
    'soundOpen' : "0", # 操作音效
    'theme' : "win10", # app theme[mac, win7, win10, metro, metro_green, alpha]
    'wall' : "8", # wall picture
    "fileRepeat" : "replace", # rename, replace, skip
    "recycleOpen" : "1", # 1 | 0代表是否开启
    'resizeConfig' :
    '{"filename":250,"filetype":80,"filesize":80,"filetime":215,"editorTreeWidth":200,"explorerTreeWidth":200}'


}




config['editorDefault'] = {
'fontSize' : '14px',
    'theme': 'tomorrow',
'autoWrap' : 1, # 自适应宽度换行
'autoComplete' : 1,
'functionList' : 1,
    "tabSize" : 4,
"softTab" : 1,
"displayChar" : 0, # 是否显示特殊字符

"fontFamily" : "Menlo", # 字体
"keyboardType" : "ace", # ace vim emacs
"autoSave" : 0, # 自动保存
}

# 多选项总配置
# http: # blog.sina.com.cn / s / blog_7981f91f01012wm7.html
# http: # monsoongale.iteye.com / blog / 1044431
config['settingAll'] ={
'language' : {
    "en" : ["English", "英语", "English"],
    "zh-CN" : ["简体中文", "简体中文", "Simplified Chinese"],
    "zh-TW" : ["繁體中文", "繁體中文", "Traditional Chinese"],
    "ar" : ["العربية", "'阿拉伯语", "Arabic"],
    "bg" : ["Български", "保加利亚语", "Bulgarian"],
    "bn" : ["বাংলা", "孟加拉语", "Bengali"],
    "ca" : ["Català", "加泰罗尼亚语", "Catalan"],
    "cs" : ["Čeština", "捷克语", "Czech"],
    "da" : ["Dansk", "丹麦语","Danish"],
    "de" : ["Deutsch","德语", "German"],
    "el" : ["Ελληνικά", "希腊语", "Greek"],
    "es" : [ "Español", "西班牙语", "Spanish"],
    "et" : ["Eesti", "爱沙尼亚语", "Estonian"],
    "fa" : [ "فارسی", "波斯语", "Persian"],
    "fi" : ["suomen", "芬兰语", "Finnish"],
    "fr" : ["Français", "法语", "French"],
    "gl" : ["Galego", "加利西亚语", "Galician"],
    "hi" : ["हिन्दी", "印地语", "Hindi"],
    "hr" : ["Hrvatski", "克罗地亚语", "Croatian"],
    "hu" : ["Magyar", "匈牙利语", "Hungarian"],
    "id" : ["Bahasa Indonesia", "印尼语", "Indonesian"],
    "it" : ["Italiano", "意大利语", "Italian"],
    "ja" : ["日本語", "日语", "Japanese"],
    "ko" : ["한국어", "韩语", "Korean"],
    "lt" : [ "Lietuvių", "立陶宛语", "Lithuanian"],
    "nl" : ["Nederlands", "荷兰语", "Dutch"],
    "no" : ["Norsk", "挪威语", "Norwegian"],
    "pl" : ["Polski", "波兰语", "Polish"],
    "pt" : ["Português", "葡萄牙语", "Portuguese"],
    "ro" : ["Limba Română", "罗马尼亚语", "Romanian"],
    "ru" : ["Русский язык", "俄语", "Russian"],
    "si" : ["සිංහල", "僧伽罗语", "Sinhala"],
    "sk" : ["Slovenčina", "捷克斯洛伐克语", "Czechoslovakia"],
    "sl" : ["Slovenski", "斯洛文尼亚语'", "Slovenian"],
    "sr" : ["Српски", "塞尔维亚语", "Serbian"],
    "sv" : ["Svenska", "瑞典语", "Swedish"],
    "ta" : ["த‌மிழ்", "泰米尔语", "Tamil"],
    "th" : ["ภาษาไทย", "泰语", "Thai"],
    "tr" : ["Türkçe", "土耳其语", "Turkish"],
    "uk" : ["Українська", "乌克兰语", "Ukrainian"],
    "uz" : ["O'zbekiston", "乌兹别克语", "Uzbek-cyrillic"],
    "vi" : ["Tiếng Việt", "越南语", "Vietnamese"],
}, # de el fi fr nl pt d / m / Y H: i

    'themeall' : "mac,win10,win7,metro,metro_green,metro_purple,metro_pink,metro_orange,alpha_image,alpha_image_sun,alpha_image_sky,diy",
    'codethemeall' : "chrome,clouds,crimson_editor,eclipse,github,kuroir,solarized_light,tomorrow,xcode,ambiance,monokai,idle_fingers,pastel_on_dark,solarized_dark,twilight,tomorrow_night_blue,tomorrow_night_eighties",
      'codefontall' : 'Source Code Pro,Consolas,Courier,DejaVu Sans Mono,Liberation Mono,Menlo,Monaco,Monospace'
}

# 权限配置；精确到需要做权限控制的控制器和方法
# 需要权限认证的Action;root组无视权限
config['roleSetting'] = {
    'explorer' : [
    'pathInfo', 'pathList', 'treeList', 'pathChmod',
    'mkdir', 'mkfile', 'pathRname', 'pathDelete', 'zip', 'unzip', 'unzipList',
    'pathCopy', 'pathCute', 'pathCuteDrag', 'pathCopyDrag', 'clipboard', 'pathPast',
    'serverDownload', 'fileUpload', 'search', 'pathDeleteRecycle',
    'fileDownload', 'zipDownload', 'fileDownloadRemove', 'fileProxy', 'fileSave', 'officeView', 'officeSave'],

'app' : ['userApp', 'initApp', 'add', 'edit', 'del'], #
'editor' : ['fileGet', 'fileSave'],

             'user' : ['changePassword', 'commonJs'], # 可以设立公用账户
'userShare' : ['set', 'del'],
    'setting' : ['set', 'systemSetting', 'phpInfo', 'systemTools'],
    'fav' : ['add', 'del', 'edit'],
    'systemMember' : ['get', 'add', 'edit', 'doAction', 'getByName'],
    'systemGroup' : ['get', 'add', 'del', 'edit'],
    'systemRole' : ['add', 'del','edit','roleGroupAction'],
# 不开放此功能【避免扩展名修改，导致系统安全问题】
'pluginApp' : ['index', 'appList', 'changeStatus', 'setConfig', 'install', 'unInstall'],
}

config['pathRoleDefine'] = {
    'read' : {
        'list' : ['explorer.index', 'explorer.pathList', 'explorer.treeList', 'editor.index', 'pluginApp.to'],
    'info' : ['explorer.pathInfo', 'explorer.search'],
    'copy' : ['explorer.pathCopy'],
    'preview' : ['explorer.image', 'explorer.unzipList', 'explorer.fileProxy',
                                                             'explorer.officeView', 'editor.fileGet'],
    'download' : ['explorer.fileDownload', 'explorer.zipDownload','explorer.fileDownloadRemove'],
},
'write' :{
    'add' : ['explorer.mkdir', 'explorer.mkfile', 'explorer.zip', 'explorer.unzip', 'app.userApp'],
            'edit' : ['explorer.officeSave', 'explorer.imageRotate', 'editor.fileSave', 'explorer.fileSave'],
'change' : ['explorer.pathRname', 'explorer.pathPast', 'explorer.pathCopyDrag',
                                            'explorer.pathCuteDrag'],
'upload' : ['explorer.fileUpload', 'explorer.serverDownload'],
'remove' : ['explorer.pathDelete', 'explorer.pathCute'],
}
}

config['pathRoleGroupDefault'] = {
    '1' : {
        "name" : "read",
    "style" : "blue-light",
    "display" : 1,
    "actions" : {
        "read:list" : 1,
         "read:info" : 1,
        "read:copy" : 1,
        "read:preview" : 1,
        "read:download" : 1,
    }
},
'2' : {
        "name" : "write",
                 'style' : "blue-deep",
    "display" : 1,
    "actions" : {
        "read:list" : 1,
        "read:info" : 1,
        "read:copy" : 1,
        "read:preview" : 1,
        "read:download" : 1,
        "write:add" : 1,
        "write:edit" : 1,
        "write:change" : 1,
        "write:upload" : 1,
        "write:remove" : 1,
    }
}
}
